package com.jisf.driver.entity.enumtype;

import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @Classname StatusEnum
 * @Description TODO 状态
 * @Date 2022/4/23 13:45
 * @Created by jisf：【429627912@qq.com】
 */
//@JSONType(serializeEnumAsJavaBean = true)
public enum CoachLicenseEnum implements BaseEnum<CoachLicenseEnum, Integer>{

    WITHOUT(0, "未拥有"),
    HAVE(1, "已拥有"),
    ;

//    @EnumValue
    private Integer code;

    @JsonValue
    private String name;

    CoachLicenseEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static CoachLicenseEnum getEnum(Integer code) {
        for (CoachLicenseEnum e : CoachLicenseEnum.values()) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        return null;
    }

    public static CoachLicenseEnum getEnum(String name){
        for (CoachLicenseEnum e : CoachLicenseEnum.values()) {
            if (e.getName().equals(name)) {
                return e;
            }
        }
        return null;
    }

}
